public class test01 {
    class Solution {
        public int findLongestChain(int[][] pairs) {
            Arrays.sort(pairs,Comparator.comparingInt(a->a[1]));
            int count = 0;
            int curNum = Integer.MIN_VALUE;
            for(int i = 0 ;i<pairs.length;i++){
                if(pairs[i][0]>curNum){
                    curNum = pairs[i][1];
                    count++;
                }
            }
            return count;
        }
    }
}
